<template>

  <infinite-container :loadMore="loadMethod" class="container" v-show="showList"
    :status="showList.status"
    ref="container"
    :swipeDownRefreshMethod="() => this.loadMethod(true)"
  >

    <transition-group name="float" >
      <component :is="useingComponent" v-for="item in showList.data" :key="'_' + item.id"
        :visibleMoreBtn="visibleMoreBtn"
        class="com-noFillet"
        :data="item"
        @click.native="onClickMethod_checkDeleted(item)"
        @clickMore="onClickMore"></component>
      <infinite-container-hint key="hint"
        :status="showList.status" :method="loadMethod"
      ></infinite-container-hint>
    </transition-group>

  </infinite-container>
</template>

<script>
import FindItem from '@c/item/FindItem'
import CarInfoItem from '@c/item/CarInfoItem'
import SignItem from '@c/item/SignItem'
import SeekCarItem from '@c/item/SeekCarItem'
import SeekPersonItem from '@c/item/SeekPersonItem'
import InfiniteContainer from '@c/InfiniteContainer'
import InfiniteContainerHint from '@c/InfiniteContainerHint'

export default {
  components: {
    FindItem,
    CarInfoItem,
    SignItem,
    SeekCarItem,
    SeekPersonItem,
    InfiniteContainer,
    InfiniteContainerHint
  },

  props: ['showList', 'useingComponent', 'loadMethod', 'onClickMethod', 'visibleMoreBtn', 'openMoreMenuMethod'],

  data (){
    return {

    }
  },

  created (){
    // console.log(this.showList)
  },

  methods: {
    getScrollViewVNode (){
      return this.$refs.container.getScrollViewVNode()
    },

    onClickMore (e, id){
      e.stopPropagation()
      this.openMoreMenuMethod(id)
    },

    onClickMethod_checkDeleted (item){
      if(item.deleted_at){
        this.$alert.toast('该条已被删除，无法查看')
      }else{
        this.onClickMethod(item.id)
      }
    }
  }
}
</script>

<style lang="less" scoped>

</style>
